<template>
  <el-dialog
      v-model="computedDialogVisible"
      title="同意提现"
      width="30%"
  >
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="computedDialogVisible=false">取消</el-button>
        <el-button type="primary" @click="handleConfirm">确认</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script lang="ts" setup>

import {computed} from "vue";
import {ElMessage} from "element-plus";
import {checkWithdrawal} from "@/api/post/invite";

const props = defineProps({dialogVisible: {type: Boolean, default: false}, id: {type: String, required: true}})
const emits = defineEmits(['update:dialog-visible', 'submit'])
let computedDialogVisible = computed({
  get: () => {
    return props.dialogVisible
  },
  set: (value) => {
    emits('update:dialog-visible', value)
  }
})

const handleConfirm = () => {
  checkWithdrawal(props.id).then(res => {
    if (res == true) {
      ElMessage.success({message: '同意成功'})
      computedDialogVisible.value = false
      emits('submit')
    }
  })
}
</script>

<style lang="scss" scoped>

</style>